package com.gxuwz.lhleavesys.service.impl;

import com.gxuwz.lhleavesys.dao.CollegeDao;
import com.gxuwz.lhleavesys.entity.College;
import com.gxuwz.lhleavesys.service.CollegeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class CollegeServiceImpl implements CollegeService {
    @Autowired
    private CollegeDao collegeDao;;

    /**
     * 根據id查詢
     * @param collegeID
     * @return
     */
    @Override
    public College getCollegeByCollegeID(String collegeID) {

        return collegeDao.findByCollegeID(collegeID);
    }

    /**
     * 查詢所有
     * @return
     */
    @Override
    public List<College> getAllColleges() {

        return collegeDao.findAll();
    }

    /**
     * 添加二級學院
     * @param
     * @return
     */
    @Override
    public boolean addCollege(College college) {

        return collegeDao.insert(college);
    }

    /**
     * 更新二級學院數據
     * @param college
     * @return
     */
    @Override
    public boolean updateCollege(College college,String id) {
        return collegeDao.update(college,id);
    }

    /**
     * 根據二級學院id刪除
     * @param collegeID
     * @return
     */
    @Override
    public boolean deleteCollege(String collegeID) {
        return collegeDao.delete(collegeID);
    }

    @Override
    public List<College> BlurQuery(String collegeName) {
        return collegeDao.findAllorOne(collegeName);
    }


}
